<template>
  <el-input v-model="searchInput" placeholder="按回车键进行搜索" @keyup.enter.native="doSearch" />
</template>

<script>
export default {
  name: 'search-input',
  data() {
    return {
      searchInput: '',
    };
  },
  computed: {
    spaceId() { return this.$route.params.spaceId; },
  },
  methods: {
    doSearch() {
      const validTitle = this.searchInput.trim();
      this.searchInput = validTitle;

      this.$router.push(`/spaces/${this.spaceId}/issues/search?title=${validTitle}`);
    },
  },
};
</script>

<style></style>
